package com.yisu.expressway.main_page;

import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import com.yisu.expressway.fragment.BaseFragment;

import java.lang.reflect.Array;
import java.util.List;

/**
 * Created by Administrator on 2016/12/8 0008.
 */

public class SlideViewPageAdapter extends FragmentPagerAdapter {

    private Context mContext;
    private BaseFragment[] fragmentArray;

    public SlideViewPageAdapter(Context context, FragmentManager fm, BaseFragment[]
            fragments) {
        super(fm);
        this.mContext = context;
        this.fragmentArray = fragments;
    }

    @Override
    public Fragment getItem(int position) {
        if(fragmentArray == null || fragmentArray.length == 0){
            return null;
        }
        return fragmentArray[position];
    }

    @Override
    public int getCount() {
        return fragmentArray == null ? 0 : fragmentArray.length;
    }

}
